From d7e49b1fe4573eb98c2e9710a9c97d172a18f61e Mon Sep 17 00:00:00 2001 From: Paul Durrant Date: Wed, 23 Nov 2011 12:03:37 +0000 Subject: [PATCH] libxl: Prevent xl save from segfaulting when control/shutdown key is removed To acknowledge the tools' setting of control/shutdown it is normal for PV drivers to rm the key. This leads to libxl__xs_read() returning NULL and thus a subsequent strcmp on the return value will cause a segfault. Signed-off-by: Paul Durrant Acked-by: Ian Jackson Committed-by: Ian Jackson --- tools/libxl/libxl_dom.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index d810655d9c..349eab6dab 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -444,6 +444,7 @@ static int libxl__domain_suspend_common_callback(void *data) usleep(100000); state = libxl__xs_read(si->gc, XBT_NULL, path); + if (!state) state = ""; watchdog--; } @@ -463,6 +464,7 @@ static int libxl__domain_suspend_common_callback(void *data) t = xs_transaction_start(ctx->xsh); state = libxl__xs_read(si->gc, t, path); + if (!state) state = ""; if (!strcmp(state, "suspend")) libxl__xs_write(si->gc, t, path, ""); -- 2.30.2